Automated software testing or verification is becoming more and more important as software systems continue to grow in size and complexity. The term automated software verification refers to machine-assisted techniques that compare the actual behavior of a software component with its predicted behavior. Verification can occur offline at compile time or it can involve running the program under test. Whether static or dynamic, automated verification always operates with respect to a notion of expected system behavior. Automated software testing allows a test program to check for properties that are specific to the system or implementation under test (IUT).
One such example of a specification as input is known as a unit test. Consider the following code,
[TestMethod]void TestAdd ( ){ArrayList a = new ArrayList(0);object o = new object( );a.Add(o);Assert.IsTrue(a[0] == o);}
TestAdd is a unit test that adds an element to an array instance. The test first creates a new array list, where the parameter to the constructor is the initial capacity, then adds a new object to the array list, and finally checks that the addition was correctly performed by verifying that a subsequent index lookup operation returns the new object.
The unit test above includes a test statement (i.e., Assert.IsTrue(a[0]==o) that compares the observed behavior with the expected result. The test is a unit test, because when it is compiled and run, it tests only the behavior of a single unit of the implementation under test.